/**
 * Copyright (C), 2015-2018, XXX有限公司
 * FileName: DeptController
 * Author:   zhouheng
 * Date:     2018/7/10 14:13
 * Description: 部门控制类
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.hengby.hengcrud.modular.sys.controller;

import com.hengby.hengcrud.core.node.ZTreeNode;
import com.hengby.hengcrud.modular.base.controller.BaseController;
import com.hengby.hengcrud.modular.sys.service.IDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 〈一句话功能简述〉<br> 
 * 〈部门控制类〉
 *
 * @author zhouheng
 * @create 2018/7/10
 * @since 1.0.0
 */

@RequestMapping("/dept")
@Controller
public class DeptController extends BaseController {
    private String PREFIX = "/system/dept/";
    @Autowired
    IDeptService deptService;

    /**
     * 获取部门的tree列表
     */
    @RequestMapping(value = "/tree")
    @ResponseBody
    public List<ZTreeNode> tree() {
        List<ZTreeNode> tree = this.deptService.tree();

        tree.add(ZTreeNode.createParent());
        return tree;
    }

}